package com.start.querydsl.service;

import com.querydsl.core.dml.DeleteClause;
import com.querydsl.core.dml.UpdateClause;
import com.querydsl.core.types.EntityPath;
import com.querydsl.jpa.JPQLQuery;
import com.querydsl.jpa.impl.JPADeleteClause;
import com.querydsl.jpa.impl.JPAUpdateClause;

/**
 * Created by IntelliJ IDEA.
 * User: wk
 * Date: 2017-07-21 下午4:25
 */
public interface BaseService {
    public JPQLQuery<Object> from(EntityPath<?>... paths);

    /**
     * Returns a {@link JPQLQuery} for the given {@link EntityPath}.
     *
     * @param path must not be {@literal null}.
     * @return
     */
    public <T> JPQLQuery<T> from(EntityPath<T> path);

    /**
     * Returns a fresh {@link DeleteClause}.
     *
     * @param path
     * @return the Querydsl {@link DeleteClause}.
     */
    public DeleteClause<JPADeleteClause> delete(EntityPath<?> path);

    /**
     * Returns a fresh {@link UpdateClause}.
     *
     * @param path
     * @return the Querydsl {@link UpdateClause}.
     */
    public UpdateClause<JPAUpdateClause> update(EntityPath<?> path);

}
